from time import*
def sort_nums(data):
   flag = 1
   while flag:
      flag = 0
      for i in range(len(data)- 1):
         if data[i] > data[i + 1]:
            data[i], data[i + 1] = data[i + 1], data[i]
            flag = 1

def read_f(file):
   data = [int(i) for i in open(file)]
   return data

def time_m(mt):
   step_1 = read_f(mt)
   time_start = time()
   sort_nums(step_1)
   time_finish = time()
   print(f'{mt} {int((time_finish-time_start)*1000)} milliseconds')

time_m("m1_sorted.txt")
time_m('m2_reverse.txt')
time_m("m3_shuffle.txt")
